﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using SERP.StringMappings;
using SERP.DAO;
using SERP.Controllers;
namespace SERP.Modules.WorkPositions{
	public partial class WorkPositionsDelete : SERP.Modules.ModuleBase
	{
		protected void Page_Load(object sender, EventArgs e){    	
			LoadLanguage();	
		}
		//Load All lable text
		private void LoadLanguage(){
			lblTitle.InnerText=SERP.Constants.APP_DELETE_TITLE+" "+WorkPositionsStringMapping.WorkPositions;
			btnFinish.Text = Constants.APP_FINISH;
			btnDelete.Text = Constants.APP_DELETE;
		}
		private bool DeleteData(){
			return viewControl.Controller.DeleteByID(Int32.Parse(Request["PositionId"]));
		}
		private void GoBack(){
			RedirectToPage("WorkPositionsList");
		}
		protected void OnCancel(object sender, EventArgs e){
			GoBack();
		} 
		protected void OnDelete(object sender, EventArgs e){
			if(DeleteData()){
				lblInfo.Text=SERP.Constants.MSS_SUCCESS;
			}
			else{
				lblInfo.Text=SERP.Constants.MSS_FAILE;
			}
			MultiView1.ActiveViewIndex=1;
		}
	}
}
